<div class="full-screen">
    <div class="page-group">
        <div class="page page-current address_pageBOX">
            <div class="coupon_page_top charge_moneyTOP">
                <a href="javascript:history.back()"><{img class="coupon_top_return" src="images/icon04.png" app="wap"}></a>
                <div class="coupon_top_text">预存款充值</div>
                <a class="charge_money_mx" href="<{link app=b2c ctl='wap_member' full='1' act='balance'}>">明细</a>
            </div>
            <form action='<{$form_action}>' method="post">
                <input type="hidden" name="payment[member_id]" value="<{$member_id}>" />
                <input type="hidden" name="payment[return_url]" value="<{$return_url}>" />
                <input type="hidden" name="payment[pay_app_id]" />
                <div class="list-block nomargin charge_money">
                    <ul>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">充值金额：</div>
                                    <div class="item-input">
                                        <input class="charge_money_input" name="payment[money]" required="required" min="1" id='deposit' placeholder="请输入充值金额">
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>

                <div class="charge_money_cue">您当前的预存款余额为：<span><{$total|cur_odr}></span></div>
                    <{foreach from=$payments item="payment" key="key" name="payments"}>
                    <div class="paymentBOX">
                        <{img class="payment_wechat" src="images/wechat.png" app="wap"}>
                        <div class="payment_text" payment_app_id="<{$payment.app_id}>" payment_app_name='<{$payment.app_display_name}>' value='{"pay_app_id":"<{$payment.app_id}>","payment_name":"<{$payment.app_display_name}>"}' id="pay_app_id_<{$payment.app_id}>">
                            <{$payment.app_display_name}>
                        </div>
                        <{img class="payment_icon" src="images/icon07_b.png" app="wap"}>
                        <div class="clearfix"></div>
                    </div>
                    <div style="height: 0.25rem;background: #f4f4f4;"></div>
                    <{/foreach}>
                <button class="charge_money_button">充值</button>
            </form>
        </div>
    </div>
</div>

<script>

$('.nav_top_bg').hide();
$('.bar-tab').hide();
if($('.paymentBOX').size()==1){
    $('input[name="payment[pay_app_id]"]').val( $('.payment_text').attr('payment_app_id') );
}
$('.paymentBOX').bind('click',function(e){
    var el = $(e.target);
    if(el.hasClass('payment_text')) {
      $('input[name="payment[pay_app_id]"]').val( el.attr('payment_app_id') );
      //el.addClass('act').siblings().removeClass('act');
    }
});

$('.charge_money_button').bind('click',function(){
    var form = $(this).parents('form');
    var money   = form.find('input[name="payment[money]"]').val();
    var payment = form.find('input[name="payment[pay_app_id]"]').val();
    if(isNaN(money) || money<=0 || !money){
        alert('充值金额请填写大于0的数值!');
        return false;
    }
    if(!payment){
        alert('必须选择一个支付方式!');
        return false;
    }
});
</script>


